/// <reference path="../utilities/FXDom.js" />
/// <reference path="../utilities/Xpcom.js" />
///--------------------------------------------------------------------
/// <file name="Sandbox.js">
///   Provides information about a thread on Neoseeker.
/// </file>
///--------------------------------------------------------------------

NAMFox.ns(function() { with (NAMFox) {

this.Sandbox = {
    evalOnPage: function(htmlDocument, script, sandboxContext) {
        var sandbox = new Components.utils.Sandbox(htmlDocument.defaultView);

        if (sandboxContext) {
            for (var i in sandboxContext) {
                var contextItem = sandboxContext[i];
                if (typeof(contextItem) === 'string' && htmlDocument.defaultView.wrappedJSObject[contextItem]) {
                    sandbox[i] = htmlDocument.defaultView.wrappedJSObject[contextItem];
                }
                else {
                    sandbox[i] = contextItem;
                }
            }
        }

        sandbox.window = htmlDocument.defaultView.wrappedJSObject;

        Components.utils.evalInSandbox(script, sandbox);
    }
};

}});